// components/article-item/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    article: Object,
    idx: Number
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    onItemTap() {
      let that = this
      wx.navigateTo({
        url: `/pages/article/article?aid=${this.data.article.id}&idx=${this.properties.idx + 1}`,
        events: {
          updateItem: async function(data) {
            that.properties.article.duration = data.data
            that.setData({
              article: that.properties.article
            })
          }
        },
        success(res) {
          res.eventChannel.emit('updateItem')
        }
      })
    }
  }
})
